package com.leeon.container.iterator;

import java.util.ArrayList;
import java.util.Iterator;
import static net.mindview.util.Print.print;

public class Gobil {

    private  int number;

    public Gobil(int num){
        this.number = num;
    }

    public void hop(){
        System.out.println("num = " + this.number + " location = ");
    }

    public static void main(String[] args){

        ArrayList<Gobil> gobils = new ArrayList<Gobil>();

        for (int i = 0; i < 10;i++){
            gobils.add(new Gobil(i));
        }

        Iterator<Gobil> it = gobils.iterator();
        while (it.hasNext()){
            it.next();
            it.next().hop();
        }

    }

}
